<?php
class infoModel extends model {
	
	public function __construct(){
		parent::__construct('info');
	}
	
	public function findAll(){
		
//		$sql      = "SELECT info.*  FROM info left join infotype  on info.info_infotype_id=infotype.id";
//		$sql      = "SELECT *  FROM info";
//        $stmt     = $this->dbh->query($sql);
//        $articles = $stmt->fetchAll();
        //var_dump($this->dao);
        $articles = $this->dao->select('id, title')->from('info')->limit(2,3)->fetchAll();
        return $articles;
		
	}

	public function indexList($page){
		$info = $this->dao->select('id, title, createtime')->from('info')->page($page)->fetchAll();
		return $info;
	}

	public function get($id){
		return $this->dao->select('*')->from('info')->where('id='.$id)->fetch();
	}

	public function mod_first5(){
		$infos = $this->dao->select('id,title,createtime')->from('info')->limit(5)->fetchAll();
		return $infos;
	}
}
